package com.accp.chs2.controller;

import com.accp.chs2.pojo.*;
import com.accp.chs2.service.ProductService;
import com.google.gson.Gson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.converter.json.GsonBuilderUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: sunliang
 * @Description: controlCreated in 2018-05-29 15:34
 * @Modified By:
 */
@RestController
@RequestMapping("/brand")
public class ProductController {

    @Autowired
    private ProductService productService;

    @GetMapping(value = "/list")
    public String list(){
        List<Product> all = productService.findAll();
        Gson gson = new Gson();
        return gson.toJson(all);
    }
}
